package com.zallds.fabric;

import com.zallds.fabric.util.CommonUtils;
import com.zallds.fabric.util.DataRecord;
import com.zallds.fabric.util.FabricUtils;
import org.apache.log4j.Logger;
import org.hyperledger.fabric.sdk.Channel;


public class TestFabricQuery {
    private static Logger logger=Logger.getLogger(TestFabricQuery.class);

    public static void main(String[] args) throws Exception{
        DataRecord dataRecord = new DataRecord("data","");

        FabricUtils.init();

        testQuery(dataRecord);

    }

    public static void testQuery(DataRecord record) throws Exception {
        logger.debug("测试Fabric 查询功能");
        Channel channel = FabricUtils.client.newChannel(CommonUtils.channelId);
        channel.addPeer(FabricUtils.client.newPeer(CommonUtils.peer0Org1Name, CommonUtils.peer0Org1Location,FabricUtils.getPeerProperty("org1.example.com","peer0.org1.example.com")));
        channel.addOrderer(FabricUtils.client.newOrderer(CommonUtils.orderName, CommonUtils.orderLocation,FabricUtils.getOrderProperty()));
        channel.initialize();
        FabricUtils.query(channel, "znw");
        //FabricUtils.invoke(channel);
        //FabricUtils.queryMoney(channel,"a");
        //FabricUtils.instantiate(channel);
        //FabricUtils.queryMoney(channel,"a");
       // FabricUtils.add(channel);
    }



}
